#! /bin/bash
## author:XueXianqi

echo `date '+%Y-%m-%d %H:%M:%S'` '正在备份当前镜像源'
sudo chmod 777 /etc/apt/sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo '
'

echo `date '+%Y-%m-%d %H:%M:%S'` '正在将镜像源替换成 阿里云'
echo > /etc/apt/sources.list
echo "
# Aliyun Mirrors
deb http://mirrors.aliyun.com/ubuntu/ focal main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ focal-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ focal main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main multiverse restricted universe
" >> /etc/apt/sources.list
echo `date '+%Y-%m-%d %H:%M:%S'` '镜像源已成功替换成 阿里云'
